package com.alex.wechat.mp.menu.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.jeecgframework.core.common.entity.IdEntity;

import com.google.common.collect.Lists;

/**
 * 自定义菜单。
 * 
 * @author Debenson
 * @since 0.1
 */
@Entity
@Table(name = "wx_menu")
public class WxMenuEntity extends IdEntity {
  private static final long serialVersionUID = 2796805554874757854L;

  private String name;
  private String menuKey;
  private String type;// click or view
  private String url;// 如果view url不能为空
  private String orders;
  private String parentId;
  private String accountId;

  @Column(name = "name", length = 100)
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  @Column(name = "menukey", length = 50)
  public String getMenuKey() {
    return menuKey;
  }

  public void setMenuKey(String menuKey) {
    this.menuKey = menuKey;
  }

  @Column(name = "type", length = 30)
  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  @Column(name = "url", length = 256)
  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  @Column(name = "orders", length = 10)
  public String getOrders() {
    return orders;
  }

  public void setOrders(String orders) {
    this.orders = orders;
  }

  @Column(name = "fatherid", length = 50)
  public String getParentId() {
    return parentId;
  }

  public void setParentId(String parentId) {
    this.parentId = parentId;
  }

  /**
   * 公众号标识
   * 
   * @return
   */
  @Column(name = "accountid", length = 50, nullable = false)
  public String getAccountId() {
    return accountId;
  }

  public void setAccountId(String accountId) {
    this.accountId = accountId;
  }

  private WxMenuEntity parent;
  private List<WxMenuEntity> children = Lists.newArrayList();

  /**
   * 父菜单。
   * 
   * @return
   */
  @Transient
  public WxMenuEntity getParent() {
    return parent;
  }

  public void setParent(WxMenuEntity parent) {
    this.parent = parent;
  }

  /**
   * 子菜单列表。
   * 
   * @return
   */
  @Transient
  public List<WxMenuEntity> getChildren() {
    return children;
  }

  public void setChildren(List<WxMenuEntity> children) {
    this.children = children;
  }

}
